{template header}
<style type="text/css">
    td:nth-child(1) { min-width: 100px; }
    td:nth-child(2) { min-width: 100px; }
    td:nth-child(3) { min-width: 50px; }
    td:nth-child(4) { min-width: 50px; }
    td:nth-child(5) { min-width: 100px;}
    td:nth-child(6) { min-width: 85px; }
    td:nth-child(7) { min-width: 200px;}
    td:nth-child(8) { min-width: 200px;}
    td:nth-child(9) { min-width: 200px;}
</style>
<a class="btn btn-edit" href="?c=admingear&a=addSet">新增</a> 
<div class="bs-docs-example pt-15" style="clear:both;">
    <table class="table table-striped table-align">
        <thead>
            <tr>
                <th>id</th>
                <th>集合名</th>
                <th>logo</th>
                <th>背景</th>
                <th width="30%">描述</th>
                <th>添加时间</th>
                <th width="20%">热度</th>
                <th width="20%">精华</th>
                <th>操作</th>               
            </tr>
        </thead>
        <tbody>
            {loop $list $k $v}
            <tr id="{$v['setId']}">
                <td>{$v['setId']}</td>
                <td>{$v['setName']}</td>
                <td>                   
                    <img style="max-width:30px;max-height:30px;" src="{$v['logo']}">                  
                </td>
                <td>                   
                    <img style="max-width:30px;max-height:30px;" src="{$v['img']}">                  
                </td>
                <td>{$v['setDescribe']}</td>                
                <td>
                {$v['addTime']}               
                </td>
                <td>
                <span class='hot'>{$v['hot']}</span>
                <a class="btn btn-small addadd" data-type='hot' data-num='-' data-id={$v['setId']}>--</a>
                <a class="btn btn-small add5" data-type='hot' data-num='-5' data-id={$v['setId']}>-5</a>                
                <a class="btn btn-small add5" data-type='hot'data-num='5' data-id={$v['setId']}>+5</a>
                <a class="btn btn-small addadd" data-type='hot' data-num='+' data-id={$v['setId']}>++</a>
                </td>
                <td>                
                <span class='best'>{$v['best']}</span>
                <a class="btn btn-small addadd" data-type='best' data-num='-' data-id={$v['setId']} >--</a>
                <a class="btn btn-small add5" data-type='best' data-num='-5' data-id={$v['setId']}>-5</a>          
                <a class="btn btn-small add5" data-type='best' data-num='5' data-id={$v['setId']}>+5</a>
                <a class="btn btn-small addadd" data-type='best' data-num='+' data-id={$v['setId']}>++</a>
                </td>
                <td>
                    <a class="btn btn-edit" href="?c=admingear&a=addSet&id={$v['setId']}">编辑</a>
                    <a class="btn btn-edit" href="?c=admingear&a=setGear&id={$v['setId']}">旗下装备</a>                   
                </td>
            </tr>
            {/loop}
        </tbody>
    </table>
</div>
<script>
$('.addadd').on('click',function(){
    var tid=$(this).attr('data-id');
    var tnum=$(this).attr('data-num');
    var ttype=$(this).attr('data-type');
    tnum=tnum+prompt('请输入'+tnum);
    $.ajax({
        url:'/admingear/addsub',
        data:{id:tid,num:tnum,type:ttype},
        type:'post',
        success:function(res){
            $('#'+tid).find('.'+ttype).html(res)
        }
    })
})
$('.add5').on('click',function(){
    var tid=$(this).attr('data-id');
    var tnum=$(this).attr('data-num');
    var ttype=$(this).attr('data-type');  
    $.ajax({
        url:'/admingear/addsub',
        data:{id:tid,num:tnum,type:ttype},
        type:'post',
        success:function(res){
            $('#'+tid).find('.'+ttype).html(res)
        }
    })
})

</script>
{template footer}